<?php
// +----------------------------------------------------------------------
// | Description: Follower数据表
// +----------------------------------------------------------------------
// | Author: xiaoliu <528772568@qq.com>
// +----------------------------------------------------------------------
namespace app\common\model;

use think\Model;

class Follower extends Model
{
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    //关注统计
    public function followercount() {
        return $this->hasMany('user', 'id', 'form_id');
    }
    //关注
    public function follower() {
        return $this->hasOne('user', 'id', 'form_id')->where('status','normal')->field('id,username,nickname,avatar,bio');
    }
    //粉丝
    public function fan() {
        return $this->hasOne('user', 'id', 'user_id')->where('status','normal')->field('id,username,nickname,avatar,bio');
    }

    //关注
    // public function hasfollower() {
    //     return $this->hasOne('user', 'id', 'form_id')->where('status','normal')->field('id,username,nickname,avatar,bio');
    // }
    
}
